import { createRouter, createWebHistory } from "vue-router";
import HomeView from "../views/IndexView/HomeView.vue";

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: "/",
      name: "home",
      component: HomeView,
    },
    {
      path: "/about",
      name: "about",
      // route level code-splitting
      // this generates a separate chunk (About.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import("../views/IndexView/AboutView.vue"),
    },
    {
      path: "/:pathMatch(.*)*",
      name: "not-found",
      component: () => import("../views/IndexView/NotFoundView.vue")
    },
    {
      path:"/login",
      name:"login",
      component: () => import("../views/User/LoginView.vue"),
    },
    {
      path:"/register",
      name:"register",
      component:()=> import("../views/User/RegisterView.vue"),
    },
    {
      path:"/goods",
       name:"goods",
      component:()=> import("../views/Goods/GoodsView.vue"),
    },
    {
      path:"/goods/addGoods",
       name:"addGoods",
      component:()=> import("../views/Goods/AddGoods.vue"),
    },
    {
      path:"/goods/detail",
       name:"detail",
      component:()=> import("../views/Goods/DetailView.vue"),
    },
    {
      path:"/carts",
      name:"carts",
      component:()=> import("../views/Carts/CartsView.vue"),
    },
    {
      path:"/order",
      name:"order",
      component:()=> import("../views/Orders/OrdersView.vue"),
    }
  ],
});

export default router;
